USE [GradingSystemDb]

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employees] (
	[EmployeeId] [int] IDENTITY(1,1) NOT NULL,
	[CourseId] [int] NOT NULL,
	[EmployeeTypeId] [int] NOT NULL,
	[FirstName] [nvarchar](max) NOT NULL,
	[MiddleName] [nvarchar](max) NOT NULL,
	[LastName] [nvarchar](max) NOT NULL,
	[HomeAddress] [nvarchar](max) NOT NULL,
	[ContactNumber] [nvarchar](max) NOT NULL,
	[EmailAddress] [nvarchar](max) NOT NULL,
	[EmployeeCode] [nvarchar](max) NOT NULL,
	[Year] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDttm] [datetime] NOT NULL,
	[ModifiedBy] [int] NOT NULL,
	[ModifiedDttm] [datetime] NOT NULL,
	CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED (
		[EmployeeId] ASC
	)
	WITH (
		PAD_INDEX=OFF, 
		STATISTICS_NORECOMPUTE=OFF, 
		IGNORE_DUP_KEY=OFF, 
		ALLOW_ROW_LOCKS=ON, 
		ALLOW_PAGE_LOCKS=ON
	) 
	ON [PRIMARY]
) 
ON [PRIMARY]

GO
ALTER TABLE	[dbo].[Employees] WITH CHECK ADD CONSTRAINT [FK_Courses_CourseId_Employees_CourseId] FOREIGN KEY([CourseId])
REFERENCES  [dbo].[Courses] ([CourseId])
GO
ALTER TABLE [dbo].[Employees] CHECK CONSTRAINT [FK_Courses_CourseId_Employees_CourseId]
GO
ALTER TABLE	[dbo].[Employees] WITH CHECK ADD CONSTRAINT [FK_EmployeeTypes_EmployeeTypeId_Employees_EmployeeTypeId] FOREIGN KEY([EmployeeTypeId])
REFERENCES  [dbo].[EmployeeTypes] ([EmployeeTypeId])
GO
ALTER TABLE [dbo].[Employees] CHECK CONSTRAINT [FK_EmployeeTypes_EmployeeTypeId_Employees_EmployeeTypeId]